﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MyPS.Models;
using MyPSDALayer;

namespace MyPS.Controllers
{
    public class CaseLibController : Controller
    {
        MyPSEntities db = new MyPSEntities();
        //
        // GET: /CaseLib/

        public ActionResult Index()
        {
            CaselibModel model = new CaselibModel();
            model.CaseTypeList = db.CaseTypes.Select(o => new V_CaseType { ID = o.ID, Name = o.CaseTypeName }).ToList();
            return View(model);
        }

        public ActionResult Details(int id)
        {
            CaseDetailsModel mode = new CaseDetailsModel();
            mode.CaseTypeList = db.CaseTypes.Select(o => new V_CaseType { ID = o.ID, Name = o.CaseTypeName }).ToList();
            mode.Case = db.CaseBases.Find(id);
            return View(mode);
        }
        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}
